package 循环;

import java.util.Scanner;

public class demo14 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入一个数");
        int a=sc.nextInt();
        int sum=0;
        for(int i=1;i<=a;i++){
            int b=1;
            for (int j=1;j<=i;j++){
                b*=j;
            }
            sum+=b;
        }
        System.out.println(sum);
    }
}
